package com.toycloud.common.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

@Configuration
public class MybatisPlusConfig {

    @Bean
    @Order(1)  // 优先级设为 1，确保 MyBatis-Plus 拦截器优先执行
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor()); // 添加分页插件
        return interceptor;
    }

    // PageHelper 分页插件可以通过配置类引入，也可以通过 yml 配置
}

